package Experiment3;

public class Teacher extends Person {
    private Course course;

    public Teacher(String teacherId, String name, String gender) {
        super(teacherId, name, gender); // 调用父类构造方法
    }

    public void openCourse(Course course) {
        this.course = course;
        System.out.println("教师 " + name + " 开设课程：" + course.getCourseName());
    }

    // 打印教师授课表
    public void printSchedule() {
        System.out.println("=== 教师 " + name + " 的授课表 ===");
        if (course != null) {
            System.out.println("课程编号: " + course.getCourseId());
            System.out.println("课程名称: " + course.getCourseName());
            System.out.println("上课地点: " + course.getLocation());
            System.out.println("上课时间: " + course.getTime());
        } else {
            System.out.println("暂无授课");
        }
        System.out.println("=========================");
    }

    // Getter方法
    public Course getCourse() {
        return course;
    }
}